<template>
    <div style="padding: 5px">
      <el-card @click="download">
        <el-row :span="24">
          <el-col :span="5">
            <el-avatar v-if="file.extName == 'docx' || file.extName == 'doc'" shape="square" :size="50" fit="fill" style="background-color: white" src="/files/docx.svg" />
            <el-avatar v-else-if="file.extName == 'pdf'" shape="square" :size="50" fit="fill" style="background-color: white" src="/files/pdf.svg" />
            <el-avatar v-else-if="file.extName == 'zip'" shape="square" :size="50" fit="fill" style="background-color: white" src="/files/zip.svg" />
            <el-avatar v-else-if="file.extName == 'jpg'" shape="square" :size="50" fit="fill" style="background-color: white" src="/files/jpg.svg" />
            <el-avatar v-else shape="square" :size="50" fit="fill" style="background-color: white" src="/files/file.svg" />
          </el-col>
          <el-col :span="2"></el-col>
          <el-col :span="16">
            {{ file.fileName }}
          </el-col>
        </el-row>
      </el-card>
    </div>
  </template>
  <script setup>
  import request from '@/utils/request'
  const emit = defineEmits(["confirm"]);
  const { proxy } = getCurrentInstance();
  const props = defineProps({
    file: {
      type: [Object],
    },
  });
  // 下载文件
  function download(){
    emit('confirm',props.file.id)
  }
  </script>
  